/**
 * Created by huangwei on 2017/3/18.
 */
//1.导包
import Vue from 'vue'
//var App = require('./App.vue');
import App from './App.vue';
import Mint from 'mint-ui';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
import VuePreview from 'vue-preview'
Vue.use(VuePreview);
// import moment from 'moment';

Vue.use(Mint);
// 导入样式
import 'mint-ui/lib/style.min.css';

//导入需要的MUI相关的框架
import '../statics/mui/css/mui.min.css'
import '../statics/mui/css/icons-extra.css'

//导入我们自己的css
import '../statics/css/site.css';

//使用我们的VueResource
Vue.use(VueResource);

//路由处理
Vue.use(VueRouter);

//定义全局时间过滤器
// Vue.filter('dateFmt',(input,dateFmtString)=>{
//     //如果没有传递时间格式,就使用默认的
//     const fmtString = dateFmtString || "YYYY-MM-DD HH:mm:ss";

//     return moment(input).format(fmtString);
// })

//创建路由https://router.vuejs.org/zh-cn/api/route-object.html
import home from './components/home/home.vue';
import member from './components/member/member.vue';
import shopcart from './components/shopcart/shopcart.vue';
import settings from './components/settings/settings.vue';
import newslist from './components/news/newlist.vue';
import newsinfo from './components/news/newlistdata.vue';
import photolist from './components/photo/photolist.vue';
import photocontent from './components/photo/photocontent.vue';

var vueRouters = new VueRouter({
    routes:[
        {path:'/',redirect:'home'},
        {name:'home',path:'/home',component:home},
        {name:'member',path:'/member',component:member},
        {name:'shopcart',path:'/shopcart',component:shopcart},
        {name:'settings',path:'/settings',component:settings},
        {name:'newslist',path:'/news/list',component:newslist},
        {name:'newsinfo',path:'/news/info/:newsId',component:newsinfo},
        {name:'photolist',path:'/photo/list',component:photolist},
        {name:'photocontent',path:'/photo/list/:photoId',component:photocontent}
    ],
    linkActiveClass:'mui-active'//替换默认的router-link-active
});

//创建Vue对象
new Vue({
    el:'#app',
    router:vueRouters,
    render:c=>c(App)//使用webpack,渲染App.vue这个根组件
})

